<extend name="Public/base" />

<block name="content">
<div id="content">
	<div id="content-header">
		<div id="breadcrumb">
			<a href="{:U('Index/index')}" title="首页" class="tip-bottom"><i
				class="icon-home"></i> 首页</a> <a href="{:U('Menu/index')}" class="current">{$meta_title}</a><present name="data_up"><a href="{:U('/Menu/index/pid/'.$data_up['id'])}">[ {$data_up.title} ] 子菜单管理</a></present><a><present name="data">[ {$data.title} ] 子子</present>菜单管理</a>
		</div>
	</div>
	<div class="container-fluid">
		<br>
		<button class="btn btn-info" onclick="location.href='{:U('add',array('pid'=>I('get.pid',0)))}'">新 增</button>
		<button class="btn btn-danger confirm" id="del">删 除</button>
        <a class="btn btn-info" href="{:U('import',array('pid'=>I('get.pid',0)))}">导 入</a>
        <a class="btn btn-warning" href="{:U('sort',array('pid'=>I('get.pid',0)),'')}">排 序</a>

		<div class="row-fluid">
			<div class="span12">
				<div class="widget-box">
					<div class="widget-content ">
						<form id="export-form" method="post" action="">
							<table id="config_table" class="table table-striped with-check">
								<thead>
									<tr>
										<th width="5%"  class="row-selected">
				                            <input class="checkbox check-all" type="checkbox">
				                        </th>
				                        <th width="5%" class="taskStatus">ID</th>
				                        <th width="15%" class="taskStatus">名称</th>
				                        <th width="13%" class="taskStatus">上级菜单</th>
				                        <th width="22%" class="taskStatus">URL</th>
				                        <th width="5%" class="taskStatus">排序</th>
				                        <th width="15%" class="taskStatus">仅开发者模式显示</th>
				                        <th width="5%" class="taskStatus">隐藏</th>
				                        <th width="15%" class="taskStatus">操作</th>
									</tr>
								</thead>
								<tbody>
									<notempty name="_list">
						                <volist name="_list" id="menu">
						                    <tr>
						                        <td><input class="ids row-selected" type="checkbox" name="id[]" value="{$menu.id}"></td>
						                        <td class="taskStatus">{$menu.id}</td>
						                        <td class="taskStatus">
						                            <a href="{:U('index?pid='.$menu['id'])}">{$menu.title}</a>
						                        </td>
						                        <td class="taskStatus">{$menu.up_title|default='无'}</td>
						                        <td class="taskStatus">{$menu.url}</td>
						                        <td class="taskStatus">{$menu.sort}</td>
						                        <td class="taskStatus">
						                            <a href="{:U('toogleDev',array('id'=>$menu['id'],'value'=>abs($menu['is_dev']-1)))}" class="ajax-get">
						                            {$menu.is_dev_text}
						                            </a>
						                        </td>
						                        <td class="taskStatus">
						                            <a href="{:U('toogleHide',array('id'=>$menu['id'],'value'=>abs($menu['hide']-1)))}" class="ajax-get">
						                            {$menu.hide_text}
						                            </a>
						                        </td>
						                        <td class="taskStatus">
						                           <!--  <a title="编辑" href="{:U('edit?id='.$menu['id'])}"><i class="icon-pencil"></i> 编辑</a> -->　<a class="confirm ajax-get" title="删除" href="{:U('del?id='.$menu['id'])}"><i class="icon-remove"></i> 删除</a>
						                        </td>
						                    </tr>
						                </volist>
									<else/>
										<tr>
											<td colspan="10" class="taskStatus"> Oh! 暂时还没有内容! </td>
										</tr>
									</notempty>
								</tbody>
							</table>
							<div class="dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi ui-buttonset-multi paging_full_numbers" id="DataTables_Table_0_paginate">
								{$_page}
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
$(function(){
	$("#del").click(function(){
		//锁定提交按钮
		$(this).attr('disabled',true);
		var self = $('form');
		$.post("{:U('del')}", self.serialize(), call_back, "json");
		return false;
		/**
		 * @todo 接收登录返回值
		 */
		function call_back(data){
			if(data.status == 1){
				tke_alert(data.info,'alert-success');
				setTimeout(function(){
					window.location.href = data.url;
				},1000);
			} else {
				tke_alert(data.info,'alert-error',1500);
				$("#del").attr('disabled',false);
			}
		}
	});
});
highlight_subnav("{:U('Menu/index')}");
</script>
</block>
